﻿Imports System.Data.SqlClient

Public Class CreateInvestorFundManager
    Implements IDisposable

#Region "Methods"
    Public Sub Dispose() Implements IDisposable.Dispose
    End Sub

    Public Function GetMasterAttributes() As IDataReader
        Dim Idrdata As IDataReader = Nothing
        Idrdata = DataFactory.CreateDataBase().ExecuteReader("CR_sp_EDS_GetMasterAttributes")
        Return Idrdata
    End Function

    Public Function CheckAndCreateNew(ByVal pstrInvestorData As String, ByVal pstrFundData As String, ByVal pintSourceTypeID As Int16, ByVal pintUserID As Integer, ByRef pblnIsInvestorSuccess As Boolean, ByRef pblnIsFundSuccess As Boolean) As DataSet
        Dim ldsdata As New DataSet
        Dim cmd As New SqlCommand
        Dim sqlParam(5) As SqlParameter
        cmd.CommandTimeout = 0
        cmd.CommandType = CommandType.StoredProcedure
        cmd.CommandText = "CR_sp_EDS_CreateNew"

        sqlParam(0) = New SqlParameter("@InvestorData", pstrInvestorData)
        cmd.Parameters.Add(sqlParam(0))
        sqlParam(1) = New SqlParameter("@FundData", pstrFundData)
        cmd.Parameters.Add(sqlParam(1))
        sqlParam(2) = New SqlParameter("@SourceTypeID", pintSourceTypeID)
        cmd.Parameters.Add(sqlParam(2))
        sqlParam(3) = New SqlParameter("@UserID", pintUserID)
        cmd.Parameters.Add(sqlParam(3))
        sqlParam(4) = New SqlParameter("@IsInvestorSucess", SqlDbType.Bit)
        sqlParam(4).Direction = ParameterDirection.Output
        cmd.Parameters.Add(sqlParam(4))
        sqlParam(5) = New SqlParameter("@IsFundSucess", SqlDbType.Bit)
        sqlParam(5).Direction = ParameterDirection.Output
        cmd.Parameters.Add(sqlParam(5))


        ldsdata = CreateDataBase.ExecuteDataSet(cmd)
        If (cmd.Parameters(4).Value IsNot DBNull.Value) Then
            pblnIsInvestorSuccess = CInt(cmd.Parameters(4).Value)
        End If
        If (cmd.Parameters(5).Value IsNot DBNull.Value) Then
            pblnIsFundSuccess = CInt(cmd.Parameters(5).Value)
        End If
        Return ldsdata
    End Function

#End Region

End Class

